package myspringbootstart.config.tomcat.server;

import myspringbootstart.config.tomcat.WebServerFactory;
import org.apache.catalina.startup.Tomcat;
import org.springframework.stereotype.Component;

@Component
public class MyTomcat implements WebServerFactory {
    public void createServer() throws Exception {
        Tomcat tomcat = new Tomcat();
        tomcat.setPort(8080);
        tomcat.addWebapp("/","D://tomcat");
        tomcat.start();
        tomcat.getServer().await();
    }
}
